﻿@model iChip.Hotspots.Models.SplashModel
@{
    ViewBag.Title = "Them moi Splash";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
}

<!-- BEGIN PAGE HEADER-->
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN PAGE TITLE & BREADCRUMB-->
        <h3 class="page-title">
            @if (Model.Splash_Id > 0)
            {
                <text>Cập nhật Splash</text>
            }
            else
            {
                <text>Thêm mới Splash</text>
            }
        </h3>
        <ul class="page-breadcrumb breadcrumb">
            <li>
                <i class="icon-home"></i>
                <a href="/Admin">Tổng quan</a>
                <i class="icon-angle-right"></i>
            </li>
            <li>
                <a href="javascript:window.history.back();">Danh sách Splash</a>
                <i class="icon-angle-right"></i>
            </li>
            <li>
                <a href="#">
                    @if (Model.Splash_Id > 0)
                    {
                        <text>Cập nhật Splash</text>
                    }
                    else
                    {
                        <text>Thêm mới Splash</text>
                    }
            </a>
            </li>
            <li class="pull-right">
            </li>
        </ul>
    <!-- END PAGE TITLE & BREADCRUMB-->
    </div>
</div>
<!-- END PAGE HEADER-->
<div class="row">
    <div class="col-md-12">
        <div class="portlet">
            <div class="portlet-body form">
                <!-- BEGIN FORM-->
                @using (Html.BeginForm("AddSplash", "Admin", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { id = "addsplash_form", @class = "form-horizontal", role = "form" }))
                {
                    @Html.AntiForgeryToken()
                    @Html.ValidationSummary(true)

                    <div class="form-body">
                        @Html.TextBoxFor(m => m.Hotspot_Id, new { placeholder = "", @class = "form-control hidden", @readonly = true })
                        @Html.TextBoxFor(m => m.Splash_Id, new { placeholder = "", @class = "form-control hidden", @readonly = true })
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    @Html.Label("Hotspot Mac", new { @class = "col-md-5 control-label" })
                                    <div class="col-md-7">
                                        @Html.TextBoxFor(m => m.Hotspot_Mac, new { placeholder = "", @class = "form-control", @readonly = true })
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    @Html.Label("Tên Splash", new { @class = "col-md-5 control-label" })
                                    <div class="col-md-7">
                                        @Html.TextBoxFor(m => m.Splash_Name, new { placeholder = "Splash Name", @class = "form-control" })
                                        @Html.ValidationMessageFor(m => m.Splash_Name)
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    @Html.Label("Link Đích", new { @class = "col-md-5 control-label" })
                                    <div class="col-md-7">
                                        @Html.TextBoxFor(m => m.Splash_UrlRedirect, new { placeholder = "Splash UrlRedirect", @class = "form-control" })
                                        @Html.ValidationMessageFor(m => m.Splash_UrlRedirect)
                                    </div>
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="form-group">
                                    @Html.Label("Nhóm Khách Hàng", new { @class = "col-md-5 control-label" })
                                    <div class="col-md-7">
                                        @if (Model.Splash_IsDefault == true)
                                        {
                                            @Html.DropDownListFor(m => m.User_Type, Model.User_TypeList, new { @class = "form-control col-md-12 hidden", @readonly = true })
                                            @Html.TextBoxFor(m => m.User_Type, new { @class = "form-control hidden", placeholder = "number", @readonly = true })
                                            @Html.ValidationMessageFor(m => m.User_Type)
                                        }
                                        else
                                        {

                                            @Html.DropDownListFor(m => m.User_Type, Model.User_TypeList, new { @class = "form-control col-md-12" })
                                            @Html.TextBoxFor(m => m.User_Type, new { @class = "form-control hidden", placeholder = "number" })
                                            @Html.ValidationMessageFor(m => m.User_Type)
                                        }
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    @Html.Label("Ngày Bắt Đầu", new { @class = "col-md-5 control-label" })
                                    <div class="col-md-7">
                                        <div class="input-group input-medium date date-picker" data-date="@DateTime.Now.ToString("dd/MM/yyyy")" data-date-format="dd/MM/yyyy" data-date-viewmode="years">
                                            @Html.TextBoxFor(m => m.Splash_StartTime, new { Value = @Model.Splash_StartTime == DateTime.MinValue ? DateTime.Now.ToString("dd/MM/yyyy") : @Model.Splash_StartTime.ToString("dd/MM/yyyy"), placeholder = "dd/MM/yyyy", @class = "form-control", @readonly = true })
                                            <span class="input-group-btn">
                                                <button class="btn default" type="button"><i class="icon-calendar"></i></button>
                                            </span>
                                        </div>

                                        @Html.ValidationMessageFor(m => m.Splash_StartTime)
                                    </div>
                                </div>
                            </div>

                            <div class="col-md-6">
                                <div class="form-group">
                                    @Html.Label("Ngày Kết Thúc", new { @class = "col-md-5 control-label" })
                                    <div class="col-md-7">
                                        <div class="input-group input-medium date date-picker" data-date="@DateTime.Now.ToString("dd/MM/yyyy")" data-date-format="dd/MM/yyyy" data-date-viewmode="years">
                                            @Html.TextBoxFor(m => m.Splash_EndTime, new { Value = @Model.Splash_EndTime == DateTime.MinValue ? DateTime.Now.ToString("dd/MM/yyyy") : @Model.Splash_EndTime.ToString("MM/dd/yyyy"), placeholder = "dd/MM/yyyy", @class = "form-control", @readonly = true })
                                            <span class="input-group-btn">
                                                <button class="btn default" type="button"><i class="icon-calendar"></i></button>
                                            </span>
                                        </div>
                                        @Html.ValidationMessageFor(m => m.Splash_EndTime)
                                    </div>
                                </div>
                            </div>
                        </div>



                        <div class="form-group">

                            <div class="col-md-12">
                                @Html.TextAreaFor(m => m.Splash_Content, new { @row = 20, @class = "ckeditor form-control", name = "editor2" })

                            </div>
                        </div>

                    </div>
                    <div class="form-actions fluid">
                        <div class="col-md-offset-3 col-md-9">
                            @if (Model.Splash_Id > 0)
                            {
                                <input type="submit" value="Cập nhật" class="btn green" />
                            }
                            else
                            {
                                <input type="submit" value="Thêm mới" class="btn blue" />
                            }
                            <a href="@ViewBag.ReturnUrl" title="Hủy" class="btn default">Hủy</a>
                        </div>
                    </div>
                }
                <!-- END FORM-->
            </div>
        </div>

    </div>
</div>
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")

    <script>

        $(function () {
            if (jQuery().datepicker) {
                $('.date-picker').datepicker({
                    rtl: App.isRTL(),
                    autoclose: true
                });
                //$('body').removeClass("modal-open"); // fix bug when inline picker is used in modal
            }
        });
        function goBack() {
            window.location.href = "/@ViewBag.ReturnUrl";
        }
    </script>
}
